<%--
  Created by IntelliJ IDEA.
  User: t
  Date: 2022/11/15
  Time: 8:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>
        var showMessage=function (input){
            var userName=input.value.trim();
            var userNamessage=document.getElementById("userNamessage");
            if (userName==""){
                userNamessage.style.color="red";
                userNamessage.innerHTML="用户名不能为空";
                return;
            }
            if (userName=="zhangsan"){
                userNamessage.style.color="red";
                userNamessage.innerHTML="用户名已经被占用";

            }else {
                userNamessage.style.color="green";
                userNamessage.innerHTML="用户名可以使用!";
            }
        }
        function showPicture(){
            document.getElementById("show").innerHTML=
                "img width=200 src='<%=request.getContextPath()%>/pictures/EE.png'>";
        }
    </script>
</head>
<body>
<input onblur="showMessage(this)" type='text'/><span id='userNamessage'></span>
<br/>
<input type="submit" onauxclick="showPicture()" value="加载图片"><span id="show"></span>
</body>
</html>
